package com.android.ringing.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.android.ringing.R;
import com.android.ringing.model.RingBean;


public class SearchAdapter extends BaseAdapter {
		
		private LayoutInflater inflater;
		private ArrayList<RingBean> myRingBeans;
		private Context myContext;


		public ArrayList<RingBean> getmyRingBeans() {
			return myRingBeans;
		}


		public void setmyRingBeans(ArrayList<RingBean> myRingBeans) {
			this.myRingBeans = myRingBeans;
		}


		public SearchAdapter(Context context) {
			inflater = LayoutInflater.from(context);
		}
		
		public SearchAdapter(Context context,ArrayList<RingBean> _myRingBeans) {
			this.myRingBeans = _myRingBeans;
			inflater = LayoutInflater.from(context);
		}

	
		public int getCount() {
			return myRingBeans.size();
		}

	
		public Object getItem(int position) {
			return position;
		}

	
		public long getItemId(int position) {
			return position;
		}

		
		public View getView(final int position, View convertView, ViewGroup parent) {
			
				
			convertView = inflater.inflate(R.layout.search_item, null);

			TextView tvName=(TextView)convertView.findViewById(R.id.tvName);
			tvName.setText(myRingBeans.get(position).getName());
			
			

			return convertView;
		}
}

	